package com.lin.chapter31.chapter1.agent;

import com.lin.chapter31.chapter1.IRunner;

import java.util.Random;

public class RunnerAgent implements IRunner {
	private IRunner runner;

	public RunnerAgent(IRunner runner) {
		this.runner = runner;
	}

	@Override
	public void run() {
		Random random = new Random();
		if (random.nextBoolean()){
			System.out.println("代理人同意安排运动员跑步");
			runner.run();
		}else {
			System.out.println("代理人心情不好，不安排运动员跑步");
		}
	}
}
